<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>

    function counter() {
        let count = 0
        return {
            getCount() {
                return count
            },
            addCount() {
                count++
            }
        }
    }

    const f = counter()
    f.addCount()
    f.addCount()
    f.addCount()
    console.log(f.getCount())
</script>
</body>
</html>
